﻿using IntelligentAgriculture.Contracts.Interface;
using IntelligentAgriculture.WebAPI.Application.Command.PregnancyCommand;
using MediatR;

namespace IntelligentAgriculture.WebAPI.Application.CommandHandler.PregnancyCommandHandler
{
    public class PregnancyDeleteCommandHandler : IRequestHandler<PregnancyDeleteCommand, int>
    {
        private readonly IPregnancyService _pregnancyService;
        public PregnancyDeleteCommandHandler(IPregnancyService pregnancyService)
        {
             _pregnancyService = pregnancyService;
        }

        public async Task<int> Handle(PregnancyDeleteCommand request, CancellationToken cancellationToken)
        {
            var entity = await _pregnancyService.DelePregnancy(request.Eartag);
            return entity;
        }
    }
}
